#!/bin/sh
#
# Simple script that will display docker repository tags.
#
# Usage:
#   $ docker-show-repo-tags.sh centos mirrorgooglecontainers/pause

#REGISTRY="https://registry.docker-cn.com"
REGISTRY="https://registry.hub.docker.com"

for repo in $* ; do
  Repo=$repo
  echo $Repo | grep / -q || Repo="library/$Repo"
  curl -s -S "$REGISTRY/v2/repositories/$Repo/tags/" | \
    sed -e 's/,/,\n/g' -e 's/\[/\[\n/g' | \
    grep '"name"' | \
    awk -F\" '{print $4;}' | \
    sort -fu | \
    sed -e "s#^#${repo}:#"
done

